import {
  request
} from './request'

export function getUserList(queryInfo) {
  return request({
    url: 'users',
    params: queryInfo
  })
}

export function updateUserInfo(userId, userState) {
  return request({
    url: `users/${userId}/state/${userState}`,
    method: 'put',
  })
}

export function addUserInfo(addForm) {
  return request({
    url: 'users',
    method: 'post',
    // post请求记得用data而不是params
    data: addForm
  })
}

export function getUserInfo(id) {
  return request({
    url: 'users/' + id,
  })
}

export function modifyUserInfo(id, email, mobile) {
  return request({
    url: `users/${id}`,
    method: 'put',
    data: {
      email,
      mobile
    }
  })
}

export function removeUserInfo(id) {
  return request({
    url: 'users/' + id,
    method: 'delete'
  })
}